﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HotTopicWinUi.provider
{
    public abstract class DataProvider<T>
    {
        private readonly List<DataObserver<T>> observers = new List<DataObserver<T>>();

        public void RegisterDataObserver(DataObserver<T> observer)
        {
            if (observer != null && !observers.Contains(observer))
            {
                observers.Add(observer);
            }
        }

        public void UnRegisterDataObser(DataObserver<T> observer)
        {
            if (observer != null && observers.Contains(observer))
            {
                observers.Remove(observer);
            }
        }

        public abstract T GetData();
    }
}
